<?php
function outGrade($grades) {
    $minScore = min($grades);
    $minJudge = '';
    foreach ($grades as $judge => $score) {
        if ($score == $minScore) {
            $minJudge = $judge;
            break;
        }
    }
    $maxScore = max($grades);
    $maxJudge = '';
    foreach ($grades as $judge => $score) {
        if ($score == $maxScore) {
            $maxJudge = $judge;
            break;
        }
    }
    echo "打出最低分的裁判为：{$minJudge}，打分为：{$minScore}\n";
    echo "打出最高分的裁判为：{$maxJudge}，打分为：{$maxScore}\n";
    $total = array_sum($grades) - $minScore - $maxScore;
    $count = count($grades) - 2;
    $average = $total / $count;
    echo "最后得分为：" . number_format($average, 2) . "\n";
}
$grades = [
    '一号裁判'=>98.2,
    '二号裁判'=>97.5,
    '三号裁判'=>91,
    '四号裁判'=>89,
    '五号裁判'=>99,
    '六号裁判'=>98.5,
    '七号裁判'=>96.6,
    '八号裁判'=>93.4,
];
outGrade($grades);